package com.uzai.common.enums;

import java.util.Objects;

/**
 * The enum Work order opt type.
 *
 * @author mingyang.chen create in 2023/6/16 14:21
 */
public enum WorkOrderOptType {

    /**
     * Bug submit work order opt type.
     */
    BUG_SUBMIT(1, "bug已处理"),
    /**
     * None bug opt work order opt type.
     */
    NONE_BUG_OPT(2, "非bug不处理"),
    /**
     * Bug to task work order opt type.
     */
    BUG_TO_TASK(3, "bug转需求"),
    /**
     * Task do work order opt type.
     */
    @Deprecated
    TASK_DO(4, "需求实施"),
    /**
     * Task no do work order opt type.
     */
    TASK_NO_DO(5, "需求未实施"),
    /**
     * No support work order opt type.
     */
    NO_SUPPORT(6, "暂不支持"),
    /**
     * Complaint handle work order opt type.
     */
    COMPLAINT_HANDLE(7, "投诉已处理"),

    /**
     * Task schedule work order opt type.
     */
    TASK_SCHEDULE(8, "需求排期"),

    /**
     * Continue talk work order opt type.
     */
    CONTINUE_TALK(9, "继续沟通"),

    /**
     * Task to bug work order opt type.
     */
    TASK_TO_BUG(10, "非需求转bug"),

    /**
     * Late support work order opt type.
     */
    LATE_SUPPORT(11, "后期支持"),

    TRANSFER_QA(12, "转交测试"),

    TRANSFER_PR(13, "转交产品"),

    PR_CONTINUE_TALK(14, "继续沟通-产品"),

    QA_CONTINUE_TALK(15, "继续沟通-测试"),

    CLOSE(16, "关闭工单"),
    ;

    private final int code;

    private final String desc;

    WorkOrderOptType(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    /**
     * Gets by code.
     *
     * @param code the code
     * @return the by code
     */
    public static WorkOrderOptType getByCode(Integer code) {
        for (WorkOrderOptType workOrderOptType : WorkOrderOptType.values()) {
            if (Objects.equals(workOrderOptType.getCode(), code)) {
                return workOrderOptType;
            }
        }
        return null;
    }

    /**
     * Gets code.
     *
     * @return the code
     */
    public int getCode() {
        return code;
    }

    /**
     * Gets desc.
     *
     * @return the desc
     */
    public String getDesc() {
        return desc;
    }
}
